Skip to content

Conversation

@aurel32
Copy link
Contributor

@aurel32 aurel32 commented Sep 23, 2021

The maximum supported speed according to the SX126x datasheet (I have
not found that information in the STM32WL datasheet or reference
manual). Increase the Sub-GHz SPI frequency from 1 Mhz to to 12 MHz,
which corresponds to a baud rate prescaler of 4 with a 48 MHz clock. It
also matches what is done the the STM32CubeWL package.

This reduces the time the MCU is kept running, thus reducing the global
power consumption.

Signed-off-by: Aurelien Jarno [email protected]

@aurel32
Copy link
Contributor Author

aurel32 commented Sep 23, 2021

@fabiobaltieri

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Sep 23, 2021

Oh neat good idea! Would be nice to make sure we are still in spec, could not find any either, maybe @ABOSTM knows something?

The cube package seems to be setting SUBGHZSPI_BAUDRATEPRESCALER_4 and I think the input clock is 48MHz (with AHB3 prescaler at 1) so it should be running at 12MHz. The SPI can either do /2 or /4 so I think that setting this to 16MHz is going to make it run at 12MHz anyway.

@aurel32
Copy link
Contributor Author

aurel32 commented Sep 23, 2021

The cube package seems to be setting SUBGHZSPI_BAUDRATEPRESCALER_4 and I think the input clock is 48MHz (with AHB3 at 1) so it should be running at 12MHz. The SPI can either do /2 or /4 so I think that setting this to 16MHz is going to make it run at 12MHz anyway.

Good catch, I'll make it 12 MHz then.

@aurel32 aurel32 force-pushed the stm32wl-subghzspi-frequency branch from 1a5da8e to 5083c59 Compare September 23, 2021 22:01
@aurel32 aurel32 changed the title dts/arm/st: wl: increase Sub-GHz SPI frequency to 16MHz dts/arm/st: wl: increase Sub-GHz SPI frequency to 12MHz Sep 23, 2021
Copy link
Contributor

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to reference manual:
image

So both 12MHz and 16MHz are possible.
Note: increasing SUBGHZSPI_SCK to 16MHZ will need to reduce PCLK3 to 32 MHZ instead of 48MHZ. And implicitly the same for SYSCLKC , HCLK1 and HCLK2. So I am not sure it is globally better.
12MHz sounds good to me

The maximum supported speed according to the SX126x datasheet (I have
not found that information in the STM32WL datasheet or reference
manual). Increase the Sub-GHz SPI frequency from 1 Mhz to to 12 MHz,
which corresponds to a baud rate prescaler of 4 with a 48 MHz clock. It
also matches what is done the the STM32CubeWL package.

This reduces the time the MCU is kept running, thus reducing the global
power consumption.

Signed-off-by: Aurelien Jarno <[email protected]>
@aurel32 aurel32 force-pushed the stm32wl-subghzspi-frequency branch from 5083c59 to 5748838 Compare September 25, 2021 16:27
@erwango erwango added this to the v3.0.0 milestone Sep 28, 2021
@erwango erwango requested a review from galak September 28, 2021 10:02
@cfriedt cfriedt merged commit 246ea73 into zephyrproject-rtos:main Sep 29, 2021
@aurel32 aurel32 deleted the stm32wl-subghzspi-frequency branch July 4, 2022 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants